<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@page import="com.ce.util.DictUtil"%>
<%@page import="com.ce.sys.login.model.*"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ include file="/common/common.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/sys/account/";  //应用的地址名
String listActionName = basePath+"SysAccount.action?op=searchjs";
String delActionName = basePath+"SysAccount_del.action?op=deljs";
String chagegStateActionName = basePath+"SysAccount_openChooseRolePage.action";  //更改用户角色
String switchUser = basePath+"SysAccount_switchUser.action";  //更改登录用户身份
User user = User.getUser();
%>
<html>
  <head>
    <base href="<%=basePath%>"></base>
    <title><%=com.ce.util.RegeditUtil.getRegeditStringValue("SYSTEM_SEG_NAME") %></title>
<script type="text/javascript">
    		$(function(){
			$('#search').linkbutton();
			$('#org').combotree({
			    url:'<%=path%>/util/util_searchOrgJsonTree.action?&',
			    params:{},
			    valueField:'id',
		        textField:'text',
		        panelWidth:200,
		        checkbox:false,
			   	onClick:function (node){
					    $(this).tree('expand',node.target);
					    $('#search').click();
			    }});
			$('#searchTable').grid({
				width:$(this).parent().width(),
				height:500,
				//title:'<div style="text-align:center;font-size:17">账号管理</div>',
				title:[<ce:menu/>],
				url:'<%=listActionName%>',
				queryParams:{"search.logname":$('#logname').val(),'search.orgId':'',"search.status":"1"},  //用于查询的参数以及初始值
				//表头列，不建议改动
				frozenColumns:[[   
	                {field:'ck',checkbox:true}
				]],
				//数据列，根据显示的内容进行修改
				columns:[[   
                        {field:'vcLogName',title:'系统登录账号',width:140,sortable:true,editor:'text'},
                        {field:'vcName',title:'对应人员名称',width:140,sortable:true,editor:'text'},
					    {field:'vcSex',title:'性别',width:50,sortable:true,editor:'text'},
				        {field:'vcOrgName',title:'所属机构',width:150,sortable:true,editor:'text'}
				        <ce:includeColum optName="chRole">
						//数据操作列，可根据情况进行修改
						,{title:'操作',width:90,field:'action',align:'center',
			            formatter:function(value,row,index){
			            	var htm = '<a style="cursor:hand;color:blue" onclick="chUserRole(\''+row.vcId+'\',\''+row.vcLogName+'\')">分配角色</a>';
			            	<%if(user.isSuperUser()){ %>
							//用户切换列，超级管理员可以切换到其它任意用户
							htm+='&nbsp;<a style="cursor:hand;color:blue" onclick="switchUser(\''+row.vcId+'\')">切换</a>';
				            <%}%>
			                return htm;
			            }}
			            </ce:includeColum>
				]],
				//功能按钮组
				toolbar:[<ce:jsonBtn/>]
			});
			//查询操作
			$('#search').click(function(){
		            defaultSearchAction({"status":"1",'orgId':$('#org').combotree('getValue')}); 
            });		
		});	
		//删除数据操作
		function deleteItems(){
		   //默认的删除操作（删除数据地址）
           defaultDeleteItems('<%=delActionName%>');
		}
		//点击帮助按钮后的操作：打开帮助界面
		function openHelpPage(){
		    defaultOpenWindow('<%=path%>/sys/menu/SysMenuHelp_look.action?chkSelf=<%=request.getAttribute("menuId").toString() %>','帮助信息查看',600,600);
		}
		//打开分配角色的界面
		function chUserRole (userId,logName){  
           defaultOpenAddPageHavebtn('<%=chagegStateActionName%>?userId='+userId,$(window).width()*4/5,$(window).height()*4/5,'请为账号 '+logName+' 分配角色');
		}
    	function switchUser(userId){
    		$('#tmpFrm').attr('src','<%=switchUser%>?userId='+userId);
    	}
    </script>
  </head>  
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >


<table border="0" cellpadding="0" cellspacing="0" align="left" width="100%" height="100%">
    <!-- 常用查询条件：正常显示 --> 
   <tr height="30"><td>
   <div id="searchDiv" class="searchDiv">
     <div id="searchLeft" style=" width:85%; float:left">
    <table><tr><td>
        部门：<input type="text" id="org" name="orgId" style="width:150px" align="absmiddle">
    </td><td>
        账号名：<input type="text" id="logname" name="logname" value='<s:property value="#parameters.logname"/>' style="width:150px" align="absmiddle">
    </td></tr></table>
     </div>
     <div id="searchRight" class="searchRight">
      <a id="search" href="javascript:void(0)"  class="easyui-linkbutton" iconCls="icon-search">查询</a>
     </div>
   </div>
   </td></tr>
   <!-- 数据结果列表 -->
   <tr><td><div id="searchTable"></div></td></tr>
</table>
<iframe width="0" height="0" id="tmpFrm"></iframe>
</body>
</html>

   
   

